<extend name="Public:common" />
<block name="content">
	<!--/sidebar-->
	<div class="main-wrap">

		<div class="crumb-wrap">
			<div class="crumb-list">
				<i class="icon-font"></i>
				<a href="__MODULE__/">首页</a>
				<span class="crumb-step">&gt;</span>
				<span class="crumb-name">角色分组列表</span>
			</div>
		</div>
		<div class="result-wrap">
			<form name="myform" id="myform" method="post">
				<div class="result-title">
					<div class="result-list">
						<a href="__URL__/addrole">
							<i class="icon-font"></i>
							添加角色
						</a>
						<a id="batchDel" href="javascript:delall(<{$p}>)">
							<i class="icon-font"></i>
							批量删除
						</a>
					</div>
				</div>
				<div class="result-content">
					<table class="result-tab" width="1125">
						<tr id='tr'>
							<th class="tc" width="30">
								<input type="checkbox" class='chkall' />
							</th>
							<th width="30">ID</th>
							<th width="10%">角色</th>
							<th>权限</th>
							<th width="7%">操作</th>
						</tr>
						<volist name='list' id='vo' empty='暂无数据'>
						<tr>
							<td class="tc">
								<input value="<{$vo.id}>" type="checkbox" name='id' class='chk'>
							</td>
							<td><{$vo.id}></td>
							<td><{$vo.name}></td>
							<td><{$vo.node}></td>
							<td>
								<a class="link-update"
									href="__MODULE__/Rbac/editrole/id/<{$vo.id}>">编辑</a>
								<a class="link-del" href="javascript:del(<{$vo.id}>);">删除</a>
							</td>
						</tr>
						</volist>
						<tr>
							<td colspan='5'>
								<div class="pages"><{$page}></div>
							</td>
						</tr>
					</table>

				</div>
			</form>
		</div>
	</div>
	<!--/main-->

<script>
	
		//全选
		$('.chkall').click(function(){
			
			$(".chk").prop('checked',this.checked)
			
		})
		//单个删除
		function del(n){
			//删除 商品 漂亮的提示信息
			$.MsgBox.Confirm("删除提示", "您确认删除该帐号", function () { 
				//发送 当前商品的id 和当前用户帐号
				$.post("__URL__/delrole",{"id":n},function(d){
					
					$.MsgBox.Alert("删除提示", d);//删除后刷新本页
					location.reload();
					// window.setTimeout("window.location='__CONTROLLER__/role/p/"+p+".html'",1000);//1秒后 跳转
				});
			})
		}
		//多个删除
		function delall(p){
			//删除 商品 漂亮的提示信息
			$.MsgBox.Confirm("删除提示", "您确认删除该帐号", function () { 
				var str = "";
				$(".chk:checked").each(function(i,e){
					str += $(e).val()+",";
				})
				if(str == ""){
					$.MsgBox.Alert("提示","<span style='color:red;'>未选择</span>");
					return;
				}
				//发送 当前商品的id 和当前用户帐号
				$.post("__MODULE__/Rbac/delrole",{"id":str},function(d){
					$.MsgBox.Alert("删除提示", d);//删除后刷新本页
					window.setTimeout("window.location='__CONTROLLER__/role/p/"+p+".html'",1000);//1秒后 跳转
				});
				
			})
		}	
	
	</script>
</block>
